package com.dzsw.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author sunz
 * @version 1.0
 * @CreateTime 2021-05-10-15:02
 */
@Slf4j
//@Component
public class BizSchedule {

    @Scheduled(cron = "${biz.test.cron:}")
    public void test() throws Exception {
        test_0();
    }

    @Scheduled(cron = "${biz.test.cron:}")
    public void test1() throws Exception {
        test1_0();
    }

    @Async
    void test_0() throws Exception {
        log.info(String.format("TEST[0] %s", Thread.currentThread().getId()));
        Thread.sleep(10 * 1000);
    }

    @Async
    void test1_0() throws Exception {
        log.info(String.format("TEST[1] %s", Thread.currentThread().getId()));
        Thread.sleep(10 * 1000);
    }
}
